{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "02f48272-1b09-4a44-b946-764be4a7ccf5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入华氏温度： 78\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "78.0华氏温度 = 25.6摄氏温度\n"
     ]
    }
   ],
   "source": [
    "# 练习1:将华氏温度转换为摄氏温度\n",
    "f = float(input(\"请输入华氏温度：\"))\n",
    "c = (f - 32) / 1.8\n",
    "print(\"%.1f华氏温度 = %.1f摄氏温度\" % (f,c))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "51d7e7b4-f60c-4c18-98c0-5d5523df756f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入圆的半径 4\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "周长：25.13\n",
      "面积：50.27\n"
     ]
    }
   ],
   "source": [
    "# 练习2:输入圆的半径计算周长和面积\n",
    "import math\n",
    "radius = int(input(\"请输入圆的半径\"))\n",
    "perimeter = 2 * math.pi * radius\n",
    "area = math.pi * radius * radius\n",
    "print(\"周长：%.2f\" % perimeter)\n",
    "print(\"面积：%.2f\" % area)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "36e19ac8-16aa-489c-9a42-a353dc2721c8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入年份： 2025\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n"
     ]
    }
   ],
   "source": [
    "# 练习3:输入年份判断是不是闰年\n",
    "year = int(input(\"请输入年份：\"))\n",
    "is_leap = (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)\n",
    "print(is_leap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "11fe8762-4a3a-4f8d-84d0-ce7624e6f209",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
